package com.liyy.platform.controller;

import com.liyy.platform.domain.Goods;
import com.liyy.platform.service.ContractProxySupplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/feign/contractProxySupply")
public class ContractProxySupplyController {

    @Autowired
    private ContractProxySupplyService contractProxySupplyService;

//代理合同的查询及分页
    @GetMapping("/getContractProxySupplyList")
    public List getContractProxySupplyList(String goodsName, String goodsBrand, String goodsAttr,
                                                 @RequestParam(defaultValue = "1") int pageNo, @RequestParam(defaultValue = "10") int pageSize ){
      return contractProxySupplyService.getContractProxySupplyList(goodsName,goodsBrand,goodsAttr,pageNo,pageSize);
    }

//    测试feign以post/get方式传递实体参数 pom文件需加feign-httpclient依赖
    @PostMapping("/testBody")
    public Map getContractProxySupplyList(){
        Goods goods=new Goods();
        goods.setCateName("测试商品名称");
        goods.setGoodsBrand("日用");
        goods.setGoodsCode("123456789");
        System.out.println(goods);
        Map<String,Object> map=new HashMap<String,Object>();
        map.put("name","zhangsan");
        map.put("age","18");
        map.put("sex","man");
        map.put("goods",goods);
        System.out.println(map);
      return contractProxySupplyService.testBody(map);
    }


}
